﻿namespace Microsoft.VisualStudio.TestTools.UnitTesting
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Diagnostics.Contracts;

    /// <summary>
    /// A utility class to help build lists.
    /// </summary>
    [DebuggerStepThrough]
    public static class ListBuilder
    {
        #region Public Methods
        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <param name="testItems">The test items.</param>
        /// <param name="argument1">The first argument.</param>
        /// <returns>
        /// The <see cref="ListItemCollection&lt;TArg1&gt;"/> to work with.
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1>> AddItem<TArg1>(
            this ListItemCollection<Tuple<TArg1>> testItems,
            TArg1 argument1)
        {
            if (testItems == null)
            {
                throw new ArgumentNullException("testItems");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1>>>() != null);

            return testItems.AddItem(new Tuple<TArg1>(argument1));
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <param name="testItems">The test items.</param>
        /// <param name="itemBuilder">The function that builds the items.</param>
        /// <returns>
        /// The <see cref="ListItemCollection&lt;TArg1&gt;"/> to work with.
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1>> AddItem<TArg1>(
            this ListItemCollection<Tuple<TArg1>> testItems,
            Func<TArg1> itemBuilder)
        {
            if (testItems == null)
            {
                throw new ArgumentNullException("testItems");
            }

            if (itemBuilder == null)
            {
                throw new ArgumentNullException("itemBuilder");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1>>>() != null);

            return testItems.AddItem(new Tuple<TArg1>(itemBuilder()));
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <param name="testItems">The test items.</param>
        /// <param name="argument1">The first argument.</param>
        /// <param name="argument2">The second argument.</param>
        /// <returns>
        /// <returns>The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.</returns>
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2>> AddItem<TArg1, TArg2>(
            this ListItemCollection<Tuple<TArg1, TArg2>> testItems,
            TArg1 argument1,
            TArg2 argument2)
        {
            if (testItems == null)
            {
                throw new ArgumentNullException("testItems");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2>>>() != null);

            return testItems.AddItem(new Tuple<TArg1, TArg2>(argument1, argument2));
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <param name="testItems">The test items.</param>
        /// <param name="itemBuilder">The function that builds the items.</param>
        /// <returns>The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        [System.Diagnostics.Contracts.ContractVerification(false)]
        public static ListItemCollection<Tuple<TArg1, TArg2>> AddItem<TArg1, TArg2>(
            this ListItemCollection<Tuple<TArg1, TArg2>> testItems,
            Func<Tuple<TArg1, TArg2>> itemBuilder)
        {
            if (testItems == null)
            {
                throw new ArgumentNullException("testItems");
            }

            if (itemBuilder == null)
            {
                throw new ArgumentNullException("itemBuilder");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2>>>() != null);

            return testItems.AddItem(itemBuilder());
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <param name="testItems">The test items.</param>
        /// <param name="argument1">The first argument.</param>
        /// <param name="argument2">The second argument.</param>
        /// <param name="argument3">The third argument.</param>
        /// <returns>
        /// <returns>The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.</returns>
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3>> AddItem<TArg1, TArg2, TArg3>(
            this ListItemCollection<Tuple<TArg1, TArg2, TArg3>> testItems,
            TArg1 argument1,
            TArg2 argument2,
            TArg3 argument3)
        {
            if (testItems == null)
            {
                throw new ArgumentNullException("testItems");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3>>>() != null);

            return testItems.AddItem(new Tuple<TArg1, TArg2, TArg3>(argument1, argument2, argument3));
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <param name="testItems">The test items.</param>
        /// <param name="itemBuilder">The function that builds the items.</param>
        /// <returns>The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3>> AddItem<TArg1, TArg2, TArg3>(
            this ListItemCollection<Tuple<TArg1, TArg2, TArg3>> testItems,
            Func<Tuple<TArg1, TArg2, TArg3>> itemBuilder)
        {
            Contract.Requires(testItems != null);
            Contract.Requires(itemBuilder != null);
            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3>>>() != null);

            return testItems.AddItem(itemBuilder);
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <typeparam name="TArg4">The type of the fourth argument.</typeparam>
        /// <param name="testItems">The test items.</param>
        /// <param name="argument1">The first argument.</param>
        /// <param name="argument2">The second argument.</param>
        /// <param name="argument3">The third argument.</param>
        /// <param name="argument4">The fourth argument.</param>
        /// <returns>
        /// The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>> AddItem<TArg1, TArg2, TArg3, TArg4>(
            this ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>> testItems,
            TArg1 argument1,
            TArg2 argument2,
            TArg3 argument3,
            TArg4 argument4)
        {
            if (testItems == null)
            {
                throw new ArgumentNullException("testItems");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>>>() != null);

            return testItems.AddItem(new Tuple<TArg1, TArg2, TArg3, TArg4>(argument1, argument2, argument3, argument4));
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <typeparam name="TArg4">The type of the fourth argument.</typeparam>
        /// <param name="testItems">The test items.</param>
        /// <param name="itemBuilder">The function that builds the items.</param>
        /// <returns>
        /// The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        [System.Diagnostics.Contracts.ContractVerification(false)]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>> AddItem<TArg1, TArg2, TArg3, TArg4>(
            this ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>> testItems,
            Func<Tuple<TArg1, TArg2, TArg3, TArg4>> itemBuilder)
        {
            if (testItems == null)
            {
                throw new ArgumentNullException("testItems");
            }

            if (itemBuilder == null)
            {
                throw new ArgumentNullException("itemBuilder");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>>>() != null);

            return testItems.AddItem(itemBuilder());
        }
        #endregion Public Methods
    }

    /// <summary>
    /// A utility class to help build lists.
    /// </summary>
    /// <typeparam name="TArg1">The type of the first argument.</typeparam>
    [DebuggerStepThrough]
    public static class ListBuilder<TArg1>
    {
        #region Public Methods
        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <param name="argument1">The first argument.</param>
        /// <returns>The <see cref="ListItemCollection&lt;TArg1&gt;"/> to work with.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1>> AddItem(TArg1 argument1)
        {
            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1>>>() != null);

            return new ListItemCollection<Tuple<TArg1>>()
                .AddItem(new Tuple<TArg1>(argument1));
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <param name="itemBuilder">The function that builds the items.</param>
        /// <returns>The <see cref="ListItemCollection&lt;TArg1&gt;"/> to work with.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1>> AddItem(Func<TArg1> itemBuilder)
        {
            if (itemBuilder == null)
            {
                throw new ArgumentNullException("itemBuilder");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1>>>() != null);

            return ListBuilder<TArg1>.AddItem(itemBuilder());
        }

        /// <summary>
        /// Adds the range of items.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <param name="argument1List">The first arguments.</param>
        /// <returns>The <see cref="ListItemCollection&lt;TArg1&gt;"/> to work with.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1>> AddRange(IEnumerable<TArg1> argument1List)
        {
            if (argument1List == null)
            {
                throw new ArgumentNullException("argument1List");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1>>>() != null);

            var list = new ListItemCollection<Tuple<TArg1>>();

            foreach (TArg1 argument in argument1List)
            {
                list.AddItem(new Tuple<TArg1>(argument));
            }

            return list;
        }
        #endregion Public Methods
    }

    /// <summary>
    /// A utility class to help build lists.
    /// </summary>
    /// <typeparam name="TArg1">The type of the first argument.</typeparam>
    /// <typeparam name="TArg2">The type of the second argument.</typeparam>
    [DebuggerStepThrough]
    public static class ListBuilder<TArg1, TArg2>
    {
        #region Public Methods
        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <param name="argument1">The first argument.</param>
        /// <param name="argument2">The second argument.</param>
        /// <returns>The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2>> AddItem(TArg1 argument1, TArg2 argument2)
        {
            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2>>>() != null);

            return new ListItemCollection<Tuple<TArg1, TArg2>>()
                .AddItem(new Tuple<TArg1, TArg2>(argument1, argument2));
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <param name="itemBuilder">The function that builds the items.</param>
        /// <returns>
        /// The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        [System.Diagnostics.Contracts.ContractVerification(false)]
        public static ListItemCollection<Tuple<TArg1, TArg2>> AddItem(Func<Tuple<TArg1, TArg2>> itemBuilder)
        {
            if (itemBuilder == null)
            {
                throw new ArgumentNullException("itemBuilder");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2>>>() != null);

            return new ListItemCollection<Tuple<TArg1, TArg2>>()
                .AddItem(itemBuilder());
        }

        /// <summary>
        /// Adds the range of items.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <param name="argument1List">The first arguments.</param>
        /// <param name="argument2List">The second arguments.</param>
        /// <returns>
        /// The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2>> AddRange(
            IEnumerable<TArg1> argument1List,
            IEnumerable<TArg2> argument2List)
        {
            if (argument1List == null)
            {
                throw new ArgumentNullException("argument1List");
            }

            if (argument2List == null)
            {
                throw new ArgumentNullException("argument2List");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2>>>() != null);

            var list = new ListItemCollection<Tuple<TArg1, TArg2>>();

            foreach (TArg1 argument1 in argument1List)
            {
                foreach (TArg2 argument2 in argument2List)
                {
                    list.AddItem(new Tuple<TArg1, TArg2>(argument1, argument2));
                }
            }

            return list;
        }
        #endregion Public Methods
    }

    /// <summary>
    /// A utility class to help build lists.
    /// </summary>
    /// <typeparam name="TArg1">The type of the first argument.</typeparam>
    /// <typeparam name="TArg2">The type of the second argument.</typeparam>
    /// <typeparam name="TArg3">The type of the third argument.</typeparam>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes", Justification = "By desing.")]
    [DebuggerStepThrough]
    public static class ListBuilder<TArg1, TArg2, TArg3>
    {
        #region Public Methods
        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <param name="argument1">The first argument.</param>
        /// <param name="argument2">The second argument.</param>
        /// <param name="argument3">The third argument.</param>
        /// <returns>The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3>> AddItem(TArg1 argument1, TArg2 argument2, TArg3 argument3)
        {
            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3>>>() != null);

            return new ListItemCollection<Tuple<TArg1, TArg2, TArg3>>()
                .AddItem(new Tuple<TArg1, TArg2, TArg3>(argument1, argument2, argument3));
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <param name="itemBuilder">The function that builds the items.</param>
        /// <returns>
        /// The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        [System.Diagnostics.Contracts.ContractVerification(false)]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3>> AddItem(Func<Tuple<TArg1, TArg2, TArg3>> itemBuilder)
        {
            if (itemBuilder == null)
            {
                throw new ArgumentNullException("itemBuilder");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3>>>() != null);

            return new ListItemCollection<Tuple<TArg1, TArg2, TArg3>>()
                .AddItem(itemBuilder());
        }

        /// <summary>
        /// Adds the range of items.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <param name="argument1List">The first arguments.</param>
        /// <param name="argument2List">The second arguments.</param>
        /// <param name="argument3List">The third arguments.</param>
        /// <returns>
        /// The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3>> AddRange(
            IEnumerable<TArg1> argument1List,
            IEnumerable<TArg2> argument2List,
            IEnumerable<TArg3> argument3List)
        {
            if (argument1List == null)
            {
                throw new ArgumentNullException("argument1List");
            }

            if (argument2List == null)
            {
                throw new ArgumentNullException("argument2List");
            }

            if (argument3List == null)
            {
                throw new ArgumentNullException("argument3List");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3>>>() != null);

            var list = new ListItemCollection<Tuple<TArg1, TArg2, TArg3>>();

            foreach (TArg1 argument1 in argument1List)
            {
                foreach (TArg2 argument2 in argument2List)
                {
                    foreach (TArg3 argument3 in argument3List)
                    {
                        list.AddItem(new Tuple<TArg1, TArg2, TArg3>(argument1, argument2, argument3));
                    }
                }
            }

            return list;
        }
        #endregion Public Methods
    }

    /// <summary>
    /// A utility class to help build lists.
    /// </summary>
    /// <typeparam name="TArg1">The type of the first argument.</typeparam>
    /// <typeparam name="TArg2">The type of the second argument.</typeparam>
    /// <typeparam name="TArg3">The type of the third argument.</typeparam>
    /// <typeparam name="TArg4">The type of the fourth argument.</typeparam>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes", Justification = "By design.")]
    [DebuggerStepThrough]
    public static class ListBuilder<TArg1, TArg2, TArg3, TArg4>
    {
        #region Public Methods
        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <typeparam name="TArg4">The type of the fourth argument.</typeparam>
        /// <param name="argument1">The first argument.</param>
        /// <param name="argument2">The second argument.</param>
        /// <param name="argument3">The third argument.</param>
        /// <param name="argument4">The fourth argument.</param>
        /// <returns>The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>> AddItem(
            TArg1 argument1,
            TArg2 argument2,
            TArg3 argument3,
            TArg4 argument4)
        {
            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>>>() != null);

            return new ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>>()
                .AddItem(new Tuple<TArg1, TArg2, TArg3, TArg4>(argument1, argument2, argument3, argument4));
        }

        /// <summary>
        /// Adds the item to the collection of tests to run.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <typeparam name="TArg4">The type of the fourth argument.</typeparam>
        /// <param name="itemBuilder">The function that builds the items.</param>
        /// <returns>The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        [System.Diagnostics.Contracts.ContractVerification(false)]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>> AddItem(
            Func<Tuple<TArg1, TArg2, TArg3, TArg4>> itemBuilder)
        {
            if (itemBuilder == null)
            {
                throw new ArgumentNullException("itemBuilder");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>>>() != null);

            return new ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>>()
                .AddItem(itemBuilder());
        }

        /// <summary>
        /// Adds the range of items.
        /// </summary>
        /// <typeparam name="TArg1">The type of the first argument.</typeparam>
        /// <typeparam name="TArg2">The type of the second argument.</typeparam>
        /// <typeparam name="TArg3">The type of the third argument.</typeparam>
        /// <typeparam name="TArg4">The type of the fourth argument.</typeparam>
        /// <param name="argument1List">The first arguments.</param>
        /// <param name="argument2List">The second arguments.</param>
        /// <param name="argument3List">The third arguments.</param>
        /// <param name="argument4List">The fourth arguments.</param>
        /// <returns>
        /// The <see cref="ListItemCollection&lt;TTuple&gt;"/> to work with.
        /// </returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypesr", Justification = "By design.")]
        public static ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>> AddRange(
            IEnumerable<TArg1> argument1List,
            IEnumerable<TArg2> argument2List,
            IEnumerable<TArg3> argument3List,
            IEnumerable<TArg4> argument4List)
        {
            if (argument1List == null)
            {
                throw new ArgumentNullException("argument1List");
            }

            if (argument2List == null)
            {
                throw new ArgumentNullException("argument2List");
            }

            if (argument3List == null)
            {
                throw new ArgumentNullException("argument3List");
            }

            if (argument4List == null)
            {
                throw new ArgumentNullException("argument4List");
            }

            Contract.Ensures(Contract.Result<ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>>>() != null);

            var list = new ListItemCollection<Tuple<TArg1, TArg2, TArg3, TArg4>>();

            foreach (TArg1 argument1 in argument1List)
            {
                foreach (TArg2 argument2 in argument2List)
                {
                    foreach (TArg3 argument3 in argument3List)
                    {
                        foreach (TArg4 argument4 in argument4List)
                        {
                            list.AddItem(new Tuple<TArg1, TArg2, TArg3, TArg4>(argument1, argument2, argument3, argument4));
                        }
                    }
                }
            }

            return list;
        }
        #endregion Public Methods
    }
}